<template>
    <div id="luckysheet" class="ft-luckysheet"></div>
</template>

<script setup>
import {
    getExcelFile,
    tableToExcel,
    transformFileToLucky,
    exportExcel,
} from './action'

/** 设置excel
 * 将表格中数据回显到excel
 */
const setExcel = data => {
    tableToExcel(data.header, data.tableData, window.luckysheet)
}
/** 获取当前excel的file数据，用于调用类似导入接口 */
const getFile = () => {
    const file = getExcelFile(window.luckysheet)
    return file
}
defineExpose({
    setExcel,
    getFile,
    transformFileToLucky,
    exportExcel,
})
</script>

<style scoped>

.ft-luckysheet {
    margin: 0px;
    padding: 0px;
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0px;
    top: 40px;
}
</style>
